﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using KhachSan.Process.Public;

namespace KhachSan.Process.Private.Bo
{
    public partial class UC_TrangThaiPhongSetting : UserControl
    {
        public UC_TrangThaiPhongSetting()
        {
            InitializeComponent();
        }
        DataTable bang;
        private void UC_TrangThaiPhongSetting_Load(object sender, EventArgs e)
        {
           bang= XLDuLieu.LoadDataTable("Select * from TrangThaiPhong");
           for (int i = 0; i < bang.Rows.Count; i++)
           {
               
               KhachSan.Process.Private.Bo.TilteImages img = new TilteImages();
               img.Tilte.Text = bang.Rows[i]["TrangThai"].ToString();
               img.Mau = (int)bang.Rows[i]["mau"];
               img.GanMau();
               pnDanhSachMau.Controls.Add(img);
           }
        }
        private void imgLuu_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < bang.Rows.Count; i++)
            {
                TilteImages img = (TilteImages)pnDanhSachMau.Controls[i];
                string lenh = string.Format("Update TrangThaiPhong set Mau={0} where MaTTP={1}",img.Mau, bang.Rows[i]["MaTTP"]);
                XLDuLieu.ExecuteNonQuery(lenh); 
            }
        }
    }
}
